package czopyk.model.persistence;

import java.io.IOException;

import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

import czopyk.model.structure.Center;

public class Serializer {

	private XMLReader parser;
	private ModelSerializer modelSerializer = new ModelSerializer();

	private String fileName;
	
	private void read() throws IOException, SAXException {
		parser = XMLReaderFactory.createXMLReader();
		parser.setContentHandler(modelSerializer);
		parser.parse(fileName);
	}
	
	public Serializer(String fileName) throws IOException, SAXException {
		this.fileName = fileName;
		read();
	}

	public Center getGate() {
		return modelSerializer.getGate();
	}
}
